#pragma once

/*

   1.定义枚举类
   2。 提供将枚举类型转换为字符串类型的函数

*/


namespace log
{
    class LogLevel
    {
    public:
        enum value
        {
            UNKNOW = 0,
            DEBUG,
            INFO,
            WARN,
            ERROR,
            FATAL,
            OFF
        };

       static  const char* toString(LogLevel::value level = UNKNOW)
        {
            switch(level)
            {
#define XX(name) \
            case LogLevel::name: \
                return #name; \
                break;

                XX(DEBUG);
                XX(INFO);
                XX(WARN);
                XX(ERROR);
                XX(FATAL);
                XX(OFF);
#undef XX
            default:
                return "UNKNOW";
            }
            return "UNKONW";
        }
    };
}
